<!DOCTYPE html>





<html class="theme-next gemini use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="generator" content="Hexo 3.9.0">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.3.0">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.3.0">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.3.0">
  <link rel="mask-icon" href="/images/logo.svg?v=7.3.0" color="#222">

<link rel="stylesheet" href="/css/main.css?v=7.3.0">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">
  <link rel="stylesheet" href="/lib/pace/pace-theme-big-counter.min.css?v=1.0.2">
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.3.0',
    exturl: false,
    sidebar: {"position":"right","display":"post","offset":12,"onmobile":false},
    back2top: {"enable":true,"sidebar":true,"scrollpercent":true},
    save_scroll: false,
    copycode: {"enable":true,"show_result":false,"style":null},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: 'search.xml',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    }
  };
</script>

  <meta name="description" content="Note&amp;#x751F;&amp;#x4EA7;&amp;#x73AF;&amp;#x5883;&amp;#x80AF;&amp;#x5B9A;&amp;#x9700;&amp;#x8981;&amp;#x5F00;&amp;#x542F;kerberos&amp;#x7684;&amp;#x3002;&amp;#x8FD9;&amp;#x4E2A;&amp;#x65F6;&amp;#x5019;&amp;#x5751;&amp;#x5C31;&amp;#x591A;&amp;#x4E86;CDH6 + IMPALA + Kerberos&amp;#x6">
<meta name="keywords" content="impala">
<meta property="og:type" content="article">
<meta property="og:title" content="Impala-JDBC-数据导入-集成kerberos认证">
<meta property="og:url" content="http://ithuhui.com/2019/07/04/bigdata-impala-jdbc-2-kerberos/index.html">
<meta property="og:site_name" content="ithuhui">
<meta property="og:description" content="Note&amp;#x751F;&amp;#x4EA7;&amp;#x73AF;&amp;#x5883;&amp;#x80AF;&amp;#x5B9A;&amp;#x9700;&amp;#x8981;&amp;#x5F00;&amp;#x542F;kerberos&amp;#x7684;&amp;#x3002;&amp;#x8FD9;&amp;#x4E2A;&amp;#x65F6;&amp;#x5019;&amp;#x5751;&amp;#x5C31;&amp;#x591A;&amp;#x4E86;CDH6 + IMPALA + Kerberos&amp;#x6">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-08-20T06:17:27.580Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Impala-JDBC-数据导入-集成kerberos认证">
<meta name="twitter:description" content="Note&amp;#x751F;&amp;#x4EA7;&amp;#x73AF;&amp;#x5883;&amp;#x80AF;&amp;#x5B9A;&amp;#x9700;&amp;#x8981;&amp;#x5F00;&amp;#x542F;kerberos&amp;#x7684;&amp;#x3002;&amp;#x8FD9;&amp;#x4E2A;&amp;#x65F6;&amp;#x5019;&amp;#x5751;&amp;#x5C31;&amp;#x591A;&amp;#x4E86;CDH6 + IMPALA + Kerberos&amp;#x6">
  <link rel="canonical" href="http://ithuhui.com/2019/07/04/bigdata-impala-jdbc-2-kerberos/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>Impala-JDBC-数据导入-集成kerberos认证 | ithuhui</title>
  


  <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?b7300352bcf49d6bfa3a57b8a0e37cdb";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>






  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  <div class="container sidebar-position-right">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">ithuhui</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">记录一切</p>
      
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
      
      
      
        
        <li class="menu-item menu-item-home">
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-about">
      
    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-tags">
      
    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-categories">
      
    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-archives">
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a href="javascript:;" class="popup-trigger">
        
          <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
      </li>
    
  </ul>

</nav>
  <div class="site-search">
    
  <div class="popup search-popup">
  <div class="search-header">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <div class="search-input-wrapper">
      <input autocomplete="off" autocorrect="off" autocapitalize="none"
             placeholder="搜索..." spellcheck="false"
             type="text" id="search-input">
    </div>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>
  <div id="search-result"></div>
</div>


  </div>
</div>
    </header>

    

  <a href="https://github.com/ithuhui" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
            

          <div id="content" class="content page-post-detail">
            

  <div id="posts" class="posts-expand">
    

  <article class="post" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://ithuhui.com/2019/07/04/bigdata-impala-jdbc-2-kerberos/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="冷大锤`">
      <meta itemprop="description" content="发牌的是上帝，出牌的是自己">
      <meta itemprop="image" content="/images/head.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="ithuhui">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">Impala-JDBC-数据导入-集成kerberos认证

          
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              
                
              

              <time title="创建时间：2019-07-04 21:28:35" itemprop="dateCreated datePublished" datetime="2019-07-04T21:28:35+08:00">2019-07-04</time>
            </span>
          
            

            
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2019-08-20 14:17:27" itemprop="dateModified" datetime="2019-08-20T14:17:27+08:00">2019-08-20</time>
              </span>
            
          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/bigdata/" itemprop="url" rel="index"><span itemprop="name">bigdata</span></a></span>

                
                
              
            </span>
          

          
            <span id="/2019/07/04/bigdata-impala-jdbc-2-kerberos/" class="post-meta-item leancloud_visitors" data-flag-title="Impala-JDBC-数据导入-集成kerberos认证" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="leancloud-visitors-count"></span>
            </span>
          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
        
      
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2019/07/04/bigdata-impala-jdbc-2-kerberos/#comments" itemprop="discussionUrl"><span class="post-comments-count valine-comment-count" data-xid="/2019/07/04/bigdata-impala-jdbc-2-kerberos/" itemprop="commentCount"></span></a>
  </span>
  
  
          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
              
                <span class="post-meta-item-text">本文字数：</span>
              
              <span>8k</span>
            </span>
          
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
              
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              
              <span>7 分钟</span>
            </span>
          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="Note"><a href="#Note" class="headerlink" title="Note"></a>Note</h1><p>&#x751F;&#x4EA7;&#x73AF;&#x5883;&#x80AF;&#x5B9A;&#x9700;&#x8981;&#x5F00;&#x542F;kerberos&#x7684;&#x3002;&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#x5751;&#x5C31;&#x591A;&#x4E86;<br>CDH6 + IMPALA + Kerberos<br>&#x672C;&#x5730;&#x6570;&#x636E;&#x4E0A;&#x4F20;&#x5230; - &gt; hdfs - &gt;&#x5BFC;&#x5165;impala</p><a id="more"></a>
<h1 id="Project"><a href="#Project" class="headerlink" title="Project"></a>Project</h1><h2 id="Application-yml"><a href="#Application-yml" class="headerlink" title="Application.yml"></a>Application.yml</h2><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment"># &#x5BFC;&#x5165;&#x914D;&#x7F6E;</span></span><br><span class="line"><span class="attr">import-config:</span></span><br><span class="line"><span class="attr">  csv-tmp-path:</span> <span class="string">/home/venus/back-end/data/import</span></span><br><span class="line">  <span class="comment">#  hive-url: jdbc:hive2://x.x.x.x:10000/default</span></span><br><span class="line"><span class="attr">  impala-url:</span> <span class="attr">jdbc:impala://xxx:21050/default;AuthMech=1;KrbRealm=EXAMPLE.COM;KrbHostFQDN=xxx;KrbServiceName=impala;</span></span><br><span class="line"><span class="attr">  impala-user:</span> <span class="string">venus</span></span><br><span class="line"><span class="attr">  impala-password:</span> <span class="string">Hantele@1234!</span></span><br><span class="line"><span class="attr">  hdfs-uri:</span> <span class="attr">hdfs://xxxx:8020</span></span><br><span class="line"><span class="attr">  hdfs-user:</span> <span class="string">venus</span></span><br><span class="line"><span class="attr">  hdfs-tmp-path:</span> <span class="string">/user/venus/web_data</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#kerberos&#x914D;&#x7F6E;</span></span><br><span class="line"><span class="attr">kerberos:</span></span><br><span class="line"><span class="attr">  krb5-file-path:</span> <span class="string">/etc/krb5.conf</span></span><br><span class="line"><span class="attr">  keytab-file-path:</span> <span class="string">/home/venus/back-end/config/venus-gzzc-bi-be/venus.keytab</span></span><br><span class="line"><span class="attr">  ker-user:</span> <span class="string">venus@EXAMPLE.COM</span></span><br></pre></td></tr></table></figure>

<h1 id="Code"><a href="#Code" class="headerlink" title="Code"></a>Code</h1><h2 id="&#x914D;&#x7F6E;&#x7C7B;"><a href="#&#x914D;&#x7F6E;&#x7C7B;" class="headerlink" title="&#x914D;&#x7F6E;&#x7C7B;"></a>&#x914D;&#x7F6E;&#x7C7B;</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * &lt;b&gt;&lt;code&gt;ImportConfig&lt;/code&gt;&lt;/b&gt;</span></span><br><span class="line"><span class="comment"> * &lt;p/&gt;</span></span><br><span class="line"><span class="comment"> * Description</span></span><br><span class="line"><span class="comment"> * &lt;p/&gt;</span></span><br><span class="line"><span class="comment"> * &lt;b&gt;Creation Time:&lt;/b&gt; 2019/6/12 16:58.</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Hu-Weihui</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="meta">@Data</span></span><br><span class="line"><span class="meta">@ConfigurationProperties</span>(prefix = <span class="string">&quot;import-config&quot;</span>)</span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">ImportConfig</span> </span>{</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> String csvTmpPath;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> String impalaUrl;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> String impalaUser;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> String impalaPassword;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> String hdfsUser;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> String hdfsUri;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> String hdfsTmpPath;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * &lt;b&gt;&lt;code&gt;KerberosConfig&lt;/code&gt;&lt;/b&gt;</span></span><br><span class="line"><span class="comment"> * &lt;p/&gt;</span></span><br><span class="line"><span class="comment"> * Description</span></span><br><span class="line"><span class="comment"> * &lt;p/&gt;</span></span><br><span class="line"><span class="comment"> * &lt;b&gt;Creation Time:&lt;/b&gt; 2019/7/5 11:12.</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Hu-Weihui</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@since</span>  ${PROJECT_VERSION}</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="meta">@Data</span></span><br><span class="line"><span class="meta">@ConfigurationProperties</span>(prefix = <span class="string">&quot;kerberos&quot;</span>)</span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">KerberosConfig</span> </span>{</span><br><span class="line"></span><br><span class="line">    <span class="comment">/** kerberos principal*/</span></span><br><span class="line">    <span class="keyword">private</span> String kerUser;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**&#x8BBE;&#x7F6E;java&#x5B89;&#x5168;krb5&#x914D;&#x7F6E;,&#x5176;&#x4E2D;krb5.conf&#x6587;&#x4EF6;&#x53EF;&#x4EE5;&#x4ECE;&#x6210;&#x529F;&#x5F00;&#x542F;kerberos&#x7684;&#x96C6;&#x7FA4;&#x4EFB;&#x610F;&#x4E00;&#x53F0;&#x8282;&#x70B9;/etc/krb5.conf&#x62FF;&#x5230;&#xFF0C;&#x653E;&#x7F6E;&#x672C;&#x5730;*/</span></span><br><span class="line">    <span class="keyword">private</span> String krb5FilePath;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/** &#x5BF9;&#x5E94;kerberos principal&#x7684;keytab&#x6587;&#x4EF6;,&#x4ECE;&#x670D;&#x52A1;&#x5668;&#x83B7;&#x53D6;&#x653E;&#x7F6E;&#x672C;&#x5730;*/</span></span><br><span class="line">    <span class="keyword">private</span> String keytabFilePath;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>

<h2 id="Kerberos&#x8BA4;&#x8BC1;&#x5DE5;&#x5177;"><a href="#Kerberos&#x8BA4;&#x8BC1;&#x5DE5;&#x5177;" class="headerlink" title="Kerberos&#x8BA4;&#x8BC1;&#x5DE5;&#x5177;"></a>Kerberos&#x8BA4;&#x8BC1;&#x5DE5;&#x5177;</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * &lt;b&gt;&lt;code&gt;KerberosUtil&lt;/code&gt;&lt;/b&gt;</span></span><br><span class="line"><span class="comment"> * &lt;p/&gt;</span></span><br><span class="line"><span class="comment"> * Description kerberos &#x8BA4;&#x8BC1;&#x5DE5;&#x5177;&#x7C7B;</span></span><br><span class="line"><span class="comment"> * &lt;p/&gt;</span></span><br><span class="line"><span class="comment"> * &lt;b&gt;Creation Time:&lt;/b&gt; 2019/7/5 11:06.</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> Hu-Weihui</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@since</span>  ${PROJECT_VERSION}</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Slf</span>4j</span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">KerberosUtil</span> </span>{</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * kerberos&#x8BA4;&#x8BC1;&#x3002;</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> configuration</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> krb5FilePath</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> kerUser</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> keytabFilePath</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> &#x8FD4;&#x56DE;kerberos&#x767B;&#x5F55;&#x5BF9;&#x8C61;&#xFF0C;&#x53EF;&#x4F7F;&#x7528;&#x6B64;&#x5BF9;&#x8C61;&#x8FDB;&#x4E00;&#x6B65;&#x64CD;&#x4F5C;</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> UserGroupInformation <span class="title">kerberosAuth</span><span class="params">(Configuration configuration, String krb5FilePath, String kerUser, String keytabFilePath)</span> </span>{</span><br><span class="line">        <span class="comment">// krb5.conf&#x914D;&#x7F6E;&#x8DEF;&#x5F84;</span></span><br><span class="line">        System.setProperty(<span class="string">&quot;java.security.krb5.conf&quot;</span>, krb5FilePath);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//&#x5F00;&#x542F;kerberos</span></span><br><span class="line">        configuration.set(<span class="string">&quot;hadoop.security.authentication&quot;</span>, <span class="string">&quot;kerberos&quot;</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//&#x9274;&#x6743;</span></span><br><span class="line">        UserGroupInformation.setConfiguration(configuration);</span><br><span class="line"></span><br><span class="line">        <span class="keyword">try</span> {</span><br><span class="line">            UserGroupInformation.loginUserFromKeytab(kerUser, keytabFilePath);</span><br><span class="line">            UserGroupInformation loginUser = UserGroupInformation.getLoginUser();</span><br><span class="line">            <span class="keyword">return</span> loginUser;</span><br><span class="line">        } <span class="keyword">catch</span> (IOException e) {</span><br><span class="line">            log.error(<span class="string">&quot;kerberos auth fail : {}&quot;</span>, e);</span><br><span class="line">        }</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">null</span>;</span><br><span class="line">    }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>

<h2 id="&#x6570;&#x636E;&#x5BFC;&#x5165;"><a href="#&#x6570;&#x636E;&#x5BFC;&#x5165;" class="headerlink" title="&#x6570;&#x636E;&#x5BFC;&#x5165;"></a>&#x6570;&#x636E;&#x5BFC;&#x5165;</h2><p>&#x5173;&#x952E;&#x70B9;&#xFF1A;</p>
<p>1.configuration&#x8BBE;&#x7F6E;&#x589E;&#x52A0;&#x4E86;&#x8FDC;&#x7AEF;&#x8BBF;&#x95EE;&#x7684;&#x914D;&#x7F6E;</p>
<p>2.&#x8FDB;&#x884C;Kerberos&#x8BA4;&#x8BC1;</p>
<p>3.IMPALA&#x64CD;&#x4F5C;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x8BA4;&#x8BC1;&#x540E;&#x7684;&#x7528;&#x6237;&#xFF08;loginUser&#xFF0C;&#x901A;&#x8FC7;UserGroupInformation&#x767B;&#x5F55;&#x540E;&#x8FD4;&#x56DE;&#xFF09;</p>
<p>4.kerberos&#x914D;&#x7F6E;&#x597D;</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment">     * IMPALA&#x6570;&#x636E;&#x5BFC;&#x5165;</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> tableName</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> updateMethod</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> multipartFile</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">importImpalaData</span><span class="params">(String tableName, String updateMethod, MultipartFile multipartFile)</span> </span>{</span><br><span class="line">        <span class="comment">// 1.csv &#x4FDD;&#x5B58;&#x5230;loacal</span></span><br><span class="line">        File localFile = saveToLocal(multipartFile);</span><br><span class="line">        String localFilePath = localFile.getPath();</span><br><span class="line">        String hdfsDstPath = importConfig.getHdfsTmpPath() + <span class="string">&quot;/&quot;</span> + localFile.getName();</span><br><span class="line">        <span class="comment">// 2.&#x4E0A;&#x4F20;&#x5230;hdfs&#x4E0A;</span></span><br><span class="line">        Path srcPath = <span class="keyword">new</span> Path(localFilePath);</span><br><span class="line">        Path dstPath = <span class="keyword">new</span> Path(hdfsDstPath);</span><br><span class="line">        Path hdfsPath = <span class="keyword">new</span> Path(importConfig.getHdfsTmpPath());</span><br><span class="line">        <span class="keyword">try</span> {</span><br><span class="line">            <span class="comment">// remote access need to set configuration</span></span><br><span class="line">            Configuration configuration = <span class="keyword">new</span> Configuration();</span><br><span class="line">            configuration.set(<span class="string">&quot;fs.defaultFS&quot;</span>, importConfig.getHdfsUri());</span><br><span class="line">            configuration.set(<span class="string">&quot;fs.hdfs.impl&quot;</span>, <span class="string">&quot;org.apache.hadoop.hdfs.DistributedFileSystem&quot;</span>);</span><br><span class="line">            configuration.set(<span class="string">&quot;dfs.client.block.write.replace-datanode-on-failure.policy&quot;</span>, <span class="string">&quot;NEVER&quot;</span>);</span><br><span class="line">            configuration.set(<span class="string">&quot; dfs.namenode.kerberos.principal&quot;</span>, <span class="string">&quot;venus@EXAMPLE.COM&quot;</span>);</span><br><span class="line">            configuration.set(<span class="string">&quot;dfs.namenode.kerberos.principal.pattern&quot;</span>, <span class="string">&quot;*@EXAMPLE.COM&quot;</span>);</span><br><span class="line">            <span class="comment">// read the config from yaml</span></span><br><span class="line">            String krb5FilePath = kerberosConfig.getKrb5FilePath();</span><br><span class="line">            String kerUser = kerberosConfig.getKerUser();</span><br><span class="line">            String keytabFilePath = kerberosConfig.getKeytabFilePath();</span><br><span class="line"></span><br><span class="line">            <span class="comment">//kerberos auth</span></span><br><span class="line">            UserGroupInformation loginUser = KerberosUtil.kerberosAuth(configuration, krb5FilePath, kerUser, keytabFilePath);</span><br><span class="line"></span><br><span class="line">            FileSystem fileSystem = FileSystem.get(configuration);</span><br><span class="line">            <span class="keyword">if</span> (!fileSystem.exists(hdfsPath)) {</span><br><span class="line">                fileSystem.mkdirs(hdfsPath);</span><br><span class="line">            }</span><br><span class="line">            fileSystem.copyFromLocalFile(srcPath, dstPath);</span><br><span class="line"></span><br><span class="line">            <span class="comment">// 3. impala &#x4F7F;&#x7528; Load&#x547D;&#x4EE4;&#x4ECE; hdfs &#x5BFC;&#x5165;&#x6570;&#x636E;</span></span><br><span class="line">            loginUser.doAs((PrivilegedAction&lt;Void&gt;) () -&gt; {</span><br><span class="line">                String url = importConfig.getImpalaUrl();</span><br><span class="line">                String user = importConfig.getImpalaUser();</span><br><span class="line">                String password = importConfig.getImpalaPassword();</span><br><span class="line"></span><br><span class="line">                <span class="keyword">try</span> (Connection connection = DriverManager.getConnection(url, user, password);</span><br><span class="line">                     Statement statement = connection.createStatement();) {</span><br><span class="line"></span><br><span class="line">                    Class.forName(<span class="string">&quot;com.cloudera.impala.jdbc41.Driver&quot;</span>);</span><br><span class="line"></span><br><span class="line">                    <span class="comment">// load data from hdfs</span></span><br><span class="line">                    String loadSql = <span class="string">&quot;LOAD DATA INPATH &apos;&quot;</span> + hdfsDstPath + <span class="string">&quot;&apos; INTO TABLE &quot;</span> + tableName;</span><br><span class="line">                    <span class="keyword">if</span> (updateMethod.equals(UpdateMethod.OVERRIDE.getCode())) {</span><br><span class="line">                        loadSql = <span class="string">&quot;LOAD DATA INPATH &apos;&quot;</span> + hdfsDstPath + <span class="string">&quot;&apos;OVERWRITE INTO TABLE &quot;</span> + tableName;</span><br><span class="line">                    }</span><br><span class="line"></span><br><span class="line">                    statement.execute(loadSql);</span><br><span class="line"></span><br><span class="line">                    <span class="comment">// refresh the impala table</span></span><br><span class="line">                    String refreshResult = String.format(<span class="string">&quot;REFRESH  %s&quot;</span>, tableName);</span><br><span class="line"></span><br><span class="line">                    statement.execute(refreshResult);</span><br><span class="line"></span><br><span class="line">                } <span class="keyword">catch</span> (ClassNotFoundException e) {</span><br><span class="line">                    log.error(<span class="string">&quot;load impala driver class fail :&quot;</span>, e);</span><br><span class="line">                    <span class="keyword">throw</span> <span class="keyword">new</span> DataManagementException(<span class="string">&quot;&#x5BFC;&#x5165;&#x6570;&#x636E;&#x5931;&#x8D25;&quot;</span>);</span><br><span class="line">                } <span class="keyword">catch</span> (SQLException e) {</span><br><span class="line">                    log.error(<span class="string">&quot;can not to load hdfs data into impala :&quot;</span>, e);</span><br><span class="line">                    <span class="keyword">throw</span> <span class="keyword">new</span> DataManagementException(<span class="string">&quot;&#x5BFC;&#x5165;&#x6570;&#x636E;&#x5931;&#x8D25;&quot;</span>);</span><br><span class="line">                }</span><br><span class="line">                <span class="keyword">return</span> <span class="keyword">null</span>;</span><br><span class="line">            });</span><br><span class="line">        } <span class="keyword">catch</span> (IOException e) {</span><br><span class="line">            log.error(<span class="string">&quot;con not get FileSystem :&quot;</span>, e);</span><br><span class="line">            <span class="keyword">throw</span> <span class="keyword">new</span> DataManagementException(<span class="string">&quot;&#x4E0A;&#x4F20;&#x5230;&#x6570;&#x636E;&#x5931;&#x8D25;&quot;</span>);</span><br><span class="line">        }</span><br><span class="line">    }</span><br></pre></td></tr></table></figure>

<h1 id="&#x722C;&#x5751;&#x65E5;&#x5FD7;"><a href="#&#x722C;&#x5751;&#x65E5;&#x5FD7;" class="headerlink" title="&#x722C;&#x5751;&#x65E5;&#x5FD7;"></a>&#x722C;&#x5751;&#x65E5;&#x5FD7;</h1><h2 id="configuration&#x914D;&#x7F6E;"><a href="#configuration&#x914D;&#x7F6E;" class="headerlink" title="configuration&#x914D;&#x7F6E;"></a>configuration&#x914D;&#x7F6E;</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">Configuration configuration = <span class="keyword">new</span> Configuration();</span><br><span class="line">configuration.set(<span class="string">&quot;fs.defaultFS&quot;</span>, importConfig.getHdfsUri());</span><br><span class="line">configuration.set(<span class="string">&quot;fs.hdfs.impl&quot;</span>, <span class="string">&quot;org.apache.hadoop.hdfs.DistributedFileSystem&quot;</span>);</span><br><span class="line">configuration.set(<span class="string">&quot;dfs.client.block.write.replace-datanode-on-failure.policy&quot;</span>, <span class="string">&quot;NEVER&quot;</span>);</span><br><span class="line">configuration.set(<span class="string">&quot; dfs.namenode.kerberos.principal&quot;</span>, <span class="string">&quot;venus@EXAMPLE.COM&quot;</span>);</span><br><span class="line">configuration.set(<span class="string">&quot;dfs.namenode.kerberos.principal.pattern&quot;</span>, <span class="string">&quot;*@EXAMPLE.COM&quot;</span>);</span><br></pre></td></tr></table></figure>

<h2 id="IMPALA&#x7684;URL"><a href="#IMPALA&#x7684;URL" class="headerlink" title="IMPALA&#x7684;URL"></a>IMPALA&#x7684;URL</h2><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">impala-url:</span> <span class="attr">jdbc:impala://xxx:21050/default;AuthMech=1;KrbRealm=EXAMPLE.COM;KrbHostFQDN=xxx;KrbServiceName=impala;</span></span><br></pre></td></tr></table></figure>

<h2 id="IMPALA&#x6267;&#x884C;&#x64CD;&#x4F5C;&#x9700;&#x8981;&#x4F7F;&#x7528;LoginUser"><a href="#IMPALA&#x6267;&#x884C;&#x64CD;&#x4F5C;&#x9700;&#x8981;&#x4F7F;&#x7528;LoginUser" class="headerlink" title="IMPALA&#x6267;&#x884C;&#x64CD;&#x4F5C;&#x9700;&#x8981;&#x4F7F;&#x7528;LoginUser"></a>IMPALA&#x6267;&#x884C;&#x64CD;&#x4F5C;&#x9700;&#x8981;&#x4F7F;&#x7528;LoginUser</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">loginUser.doAs((PrivilegedAction&lt;Void&gt;) () -&gt; {</span><br><span class="line">             <span class="comment">//....todo </span></span><br><span class="line">           });</span><br></pre></td></tr></table></figure>

<h2 id="&#x786E;&#x8BA4;&#x597D;&#x4E86;&#x4F60;&#x7684;&#x751F;&#x4EA7;&#x73AF;&#x5883;Kerberos&#x6CA1;&#x95EE;&#x9898;&#xFF01;&#xFF01;"><a href="#&#x786E;&#x8BA4;&#x597D;&#x4E86;&#x4F60;&#x7684;&#x751F;&#x4EA7;&#x73AF;&#x5883;Kerberos&#x6CA1;&#x95EE;&#x9898;&#xFF01;&#xFF01;" class="headerlink" title="&#x786E;&#x8BA4;&#x597D;&#x4E86;&#x4F60;&#x7684;&#x751F;&#x4EA7;&#x73AF;&#x5883;Kerberos&#x6CA1;&#x95EE;&#x9898;&#xFF01;&#xFF01;"></a>&#x786E;&#x8BA4;&#x597D;&#x4E86;&#x4F60;&#x7684;&#x751F;&#x4EA7;&#x73AF;&#x5883;Kerberos&#x6CA1;&#x95EE;&#x9898;&#xFF01;&#xFF01;</h2><ol>
<li>&#x786E;&#x4FDD;&#x4F60;&#x7684;&#x7528;&#x6237;&#x662F;&#x80FD;&#x8BA4;&#x8BC1;kerberos&#x5E76;&#x4E14;&#x8BBF;&#x95EE;HDFS&amp;IMPALA</li>
<li>&#x5949;&#x529D;&#x751F;&#x4EA7;&#x73AF;&#x5883;&#x522B;&#x7528;IMPALA&#x548C;HDFS&#x8FD9;&#x4E24;&#x4E2A;&#x9ED8;&#x8BA4;&#x7528;&#x6237;</li>
<li>&#x65B0;&#x589E;&#x4E00;&#x4E2A;&#x80FD;&#x4F7F;&#x7528;&#x53CC;&#x65B9;&#x7684;&#x7528;&#x6237;&#x3002;&#x4E3E;&#x4F8B;huweihui&#xFF0C;&#x628A;&#x8BE5;&#x7528;&#x6237;&#x52A0;&#x5230;&#x548C;hdfs&#x548C;impala&#x540C;&#x4E00;&#x4E2A;supergroup&#x91CC;&#x9762;&#x3002;&#xFF08;&#x4E0D;&#x61C2;&#x7684;&#x627E;&#x4E13;&#x4E1A;&#x5B89;&#x88C5;CDH&#x7684;&#x4EBA;&#xFF09;</li>
<li>&#x5B89;&#x88C5;&#x5B8C;kerberos&#x8981;&#x7ED9;&#x5BF9;&#x5E94;&#x7528;&#x6237;&#x751F;&#x6210; keytab&#x6587;&#x4EF6;&#x5E76;&#x4E14;copy&#x5230;&#x9879;&#x76EE; </li>
<li>&#x4E0A;&#x9762;&#x7B2C;3&#x70B9;&#x9700;&#x8981;&#x4EA7;&#x751F;&#x4E00;&#x4E2A;<a href="mailto:huweihui@EXAMPLE.COM" target="_blank" rel="noopener">huweihui@EXAMPLE.COM</a>&#x7684;&#x8D26;&#x6237;&#x3002;root&#x767B;&#x5F55;Kereros&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x6267;&#x884C;kadmin.local - &gt; listprincs(&#x67E5;&#x770B;&#x7528;&#x6237;&#x5217;&#x8868;&#x5FC5;&#x987B;&#x6709;&#x4E00;&#x4E2A; <a href="mailto:huweihui@EXAMPLE.COM" target="_blank" rel="noopener">huweihui@EXAMPLE.COM</a>)</li>
<li>&#x7F51;&#x4E0A;&#x5751;&#x8D27;&#x592A;&#x591A;&#xFF0C;&#x5EFA;&#x8BAE;&#x76F4;&#x63A5;&#x770B;CDH impala-jdbc.dirver&#x5305;&#x7684;&#x4F7F;&#x7528;&#x6587;&#x6863;&#x3002;&#x9644;&#x4E0A;&#x94FE;&#x63A5;&#xFF1A;<a href="https://www.cloudera.com/documentation/other/connectors/impala-jdbc/latest.html" target="_blank" rel="noopener">https://www.cloudera.com/documentation/other/connectors/impala-jdbc/latest.html</a><br>Installation Guide &#xFF08;&#x5728;&#x7EBF;PDF&#xFF09;-&gt;CONFIGURING AUTHENTICATION -&gt; USING KERBEROS &#xFF08;11&#x9875;&#xFF09;</li>
<li>&#x63A8;&#x8350;&#x4E00;&#x4E2A;Kerberos&#x5E38;&#x7528;&#x547D;&#x4EE4;&#x7684;BLOG &#xFF1A;<a href="https://www.jianshu.com/p/69e6a2e7c648" target="_blank" rel="noopener">https://www.jianshu.com/p/69e6a2e7c648</a></li>
<li>&#x600E;&#x4E48;&#x5B89;&#x88C5;Kerberos&#x548C;&#x914D;&#x7F6E;&#x8D26;&#x53F7;&#x8BF7;&#x81EA;&#x5DF1;&#x67E5;&#x8BE2;&#x4E00;&#x4E0B;&#xFF0C;&#x4F46;&#x662F;&#x4E0A;&#x8FF0;&#x90FD;&#x662F;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x5173;&#x952E;&#x70B9;</li>
</ol>

    </div>

    
    
    
        
      
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>冷大锤`</li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://ithuhui.com/2019/07/04/bigdata-impala-jdbc-2-kerberos/" title="Impala-JDBC-数据导入-集成kerberos认证">http://ithuhui.com/2019/07/04/bigdata-impala-jdbc-2-kerberos/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！</li>
</ul>
</div>

      

      <footer class="post-footer">
          
            
          
          <div class="post-tags">
            
              <a href="/tags/impala/" rel="tag"># impala</a>
            
          </div>
        

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
              
                <a href="/2019/07/03/bigdata-impala-jdbc-1/" rel="next" title="Impala-JDBC-数据导入">
                  <i class="fa fa-chevron-left"></i> Impala-JDBC-数据导入
                </a>
              
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
              
                <a href="/2019/08/21/springboot-threadPoolTaskExecutor/" rel="prev" title="springboot-threadPoolTaskExecutor">
                  springboot-threadPoolTaskExecutor <i class="fa fa-chevron-right"></i>
                </a>
              
            </div>
          </div>
        
      </footer>
    
  </div>
  
  
  
  </article>

  </div>


          </div>
          
    
    <div class="comments" id="comments"></div>
  

        </div>
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">

          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image"
      src="/images/head.png"
      alt="冷大锤`">
  <p class="site-author-name" itemprop="name">冷大锤`</p>
  <div class="site-description motion-element" itemprop="description">发牌的是上帝，出牌的是自己</div>
</div>
  <nav class="site-state motion-element">
      <div class="site-state-item site-state-posts">
        
          <a href="/archives/">
        
          <span class="site-state-item-count">34</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-categories">
        
          
            <a href="/categories/">
          
        
        
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">分类</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-tags">
        
          
            <a href="/tags/">
          
        
        
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">标签</span>
        </a>
      </div>
    
  </nav>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://github.com/ithuhui" title="GitHub &rarr; https://github.com/ithuhui" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="mailto:hu545548724@163.com" title="E-Mail &rarr; mailto:hu545548724@163.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
    
  </div>




        </div>
      </div>
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#Note"><span class="nav-number">1.</span> <span class="nav-text">Note</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Project"><span class="nav-number">2.</span> <span class="nav-text">Project</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Application-yml"><span class="nav-number">2.1.</span> <span class="nav-text">Application.yml</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Code"><span class="nav-number">3.</span> <span class="nav-text">Code</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#配置类"><span class="nav-number">3.1.</span> <span class="nav-text">配置类</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Kerberos认证工具"><span class="nav-number">3.2.</span> <span class="nav-text">Kerberos认证工具</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#数据导入"><span class="nav-number">3.3.</span> <span class="nav-text">数据导入</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#爬坑日志"><span class="nav-number">4.</span> <span class="nav-text">爬坑日志</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#configuration配置"><span class="nav-number">4.1.</span> <span class="nav-text">configuration配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#IMPALA的URL"><span class="nav-number">4.2.</span> <span class="nav-text">IMPALA的URL</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#IMPALA执行操作需要使用LoginUser"><span class="nav-number">4.3.</span> <span class="nav-text">IMPALA执行操作需要使用LoginUser</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#确认好了你的生产环境Kerberos没问题！！"><span class="nav-number">4.4.</span> <span class="nav-text">确认好了你的生产环境Kerberos没问题！！</span></a></li></ol></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2016 – <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">冷大锤`</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
      <span class="post-meta-item-text">站点总字数：</span>
    
    <span title="站点总字数">238k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    
    <span title="站点阅读时长">3:36</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.9.0</div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> v7.3.0</div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  
    <span class="post-meta-divider">|</span>
  
    <span class="post-meta-item-icon">
      <i class="fa fa-eye"></i>
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>








        
      </div>
    </footer>

    

  </div>

  
  <script src="/lib/jquery/index.js?v=3.4.1"></script>
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

<script src="/js/utils.js?v=7.3.0"></script><script src="/js/motion.js?v=7.3.0"></script>

<script src="/js/schemes/pisces.js?v=7.3.0"></script>



<script src="/js/next-boot.js?v=7.3.0"></script>




  





  
  <script>
  function leancloudSelector(url) {
    return document.getElementById(url).querySelector('.leancloud-visitors-count');
  }
  if (CONFIG.page.isPost) {
    function addCount(Counter) {
      var visitors = document.querySelector('.leancloud_visitors');
      var url = visitors.getAttribute('id').trim();
      var title = visitors.getAttribute('data-flag-title').trim();

      Counter('get', `/classes/Counter?where=${JSON.stringify({ url })}`)
        .then(response => response.json())
        .then(({ results }) => {
          if (results.length > 0) {
            var counter = results[0];
            Counter('put', '/classes/Counter/' + counter.objectId, { time: { '__op': 'Increment', 'amount': 1 } })
              .then(response => response.json())
              .then(() => {
                leancloudSelector(url).innerText = counter.time + 1;
              })
            
              .catch(error => {
                console.log('Failed to save visitor count', error);
              })
          } else {
              Counter('post', '/classes/Counter', { title: title, url: url, time: 1 })
                .then(response => response.json())
                .then(() => {
                  leancloudSelector(url).innerText = 1;
                })
                .catch(error => {
                  console.log('Failed to create', error);
                });
            
          }
        })
        .catch(error => {
          console.log('LeanCloud Counter Error', error);
        });
    }
  } else {
    function showTime(Counter) {
      var visitors = document.querySelectorAll('.leancloud_visitors');
      var entries = [...visitors].map(element => {
        return element.getAttribute('id').trim();
      });

      Counter('get', `/classes/Counter?where=${JSON.stringify({ url: { '$in': entries } })}`)
        .then(response => response.json())
        .then(({ results }) => {
          if (results.length === 0) {
            document.querySelectorAll('.leancloud_visitors .leancloud-visitors-count').forEach(element => {
              element.innerText = 0;
            });
            return;
          }
          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.url;
            var time = item.time;
            leancloudSelector(url).innerText = time;
          }
          for (var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = leancloudSelector(url);
            if (element.innerText == '') {
              element.innerText = 0;
            }
          }
        })
        .catch(error => {
          console.log('LeanCloud Counter Error', error);
        });
    }
  }

  fetch('https://app-router.leancloud.cn/2/route?appId=u7lzh9sG1gDGC8h3Ag4jEhxD-gzGzoHsz')
    .then(response => response.json())
    .then(({ api_server }) => {
      var Counter = (method, url, data) => {
        return fetch(`https://${api_server}/1.1${url}`, {
          method: method,
          headers: {
            'X-LC-Id': 'u7lzh9sG1gDGC8h3Ag4jEhxD-gzGzoHsz',
            'X-LC-Key': 'jRXlISNU0c9YNOrnTr60TQls',
            'Content-Type': 'application/json',
          },
          body: JSON.stringify(data)
        });
      };
      if (CONFIG.page.isPost) {
        const localhost = /http:\/\/(localhost|127.0.0.1|0.0.0.0)/;
        if (localhost.test(document.URL)) return;
        addCount(Counter);
      } else if (document.querySelectorAll('.post-title-link').length >= 1) {
        showTime(Counter);
      }
    });
  </script>










  <script src="/js/local-search.js?v=7.3.0"></script>














  

  

  


  
  <script src="/js/scrollspy.js?v=7.3.0"></script><script src="/js/post-details.js?v=7.3.0"></script>



<script>
NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
  var GUEST = ['nick', 'mail', 'link'];
  var guest = 'nick,mail';
  guest = guest.split(',').filter(item => {
    return GUEST.indexOf(item) > -1;
  });
  new Valine({
    el: '#comments',
    verify: false,
    notify: false,
    appId: 'TIuoGjr6GXVsHwA9SzloOpGQ-gzGzoHsz',
    appKey: 'y6Va0n1Hs7FlD9RgvPCF70R3',
    placeholder: 'Just go go',
    avatar: 'mm',
    meta: guest,
    pageSize: '10' || 10,
    visitor: false,
    lang: '' || 'zh-cn',
    path: location.pathname
  });
}, window.Valine);
</script>

</body>
</html>
